package com.test.suanfa;

public class YanHui {
    public static void main(String[] args){

        int[][] array = new int[5][5];

        array[0][0] = 1;
        array[1][0] = 1;
        array[1][1] = 1;
        for (int i = 0; i < 5; i++) {

            for (int j = 0; j <= i; j++) {

                if (i != 0 && i != 1) {
                    if(j==0) {
                        array[i][j] = 1;
                    }else {
                        int value = array[i - 1][j] + array[i - 1][j - 1];
                        array[i][j] = value;
                        System.out.println("value==" + value);
                    }
                }


            }
        }

        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println();
        }

    }
}
